4.6 Input Text Box

The Inbox class is derived from the Outbox class described in the preceding section. It may be considered as a single row Outbox Object with the new added feature - Scanf method. Indeed Inbox is a Virtual Panels style scanf.

Constructor:

Inbox (
int x0,int y0, // coord. of LEFT-TOP corner of Indicator
objtype type, // may be FIXED, PERM, POPUP
char * title, // title of Inbox
int columns, // size of box in characters
//———- Hereafter are defaults
int frame=FRAMED,// display may FRAMED or UNFRAMED
// procedure supplied by programmer to repaint Inbox
void (far * paintproc)()=procNULL,
int titlefont=0,int titlefontsize=1, // title font
plaquecolors obxcolcnfg = plaquecoldflt,// colors of frame
outboxcolors obxcolors = obxcoldflt , // and display
int titlejustify = CENTER_TEXT); // for system use

The constructor is like the Outbox constructor except the row parameter is absent (it always is equal to 1).

Data members:

All are inherited from the object base class (see sect.4).

Methods:

Includes all methods of Outbox (sect.4.5) and object (sect.4) classes.

int Scanf( const char *format,...);

Scans a series of input fields one character at a time, formats each field according to the format specifier passed in the format string *format and stores the formatted input at an addresses passed as an arguments following *format. In effect it is the same standard scanf function suited for the Virtual Panels. To enter data push the one of the next keys on the keyboard: Enter, ESC, Tab or Shift-Tab.

Returns:
0 if Shift-Tab has been pushed
9 if Tab has been pushed
13 if CR has been pushed
27 if ESC has been pushed
-1 if no data has been entered (error)


Color schemes:

The default color scheme for Inbox is

const outboxcolors ibxcoldflt=
        { YELLOW, WHITE, YELLOW, LIGHTGRAY };
//         title   text  hltext      paper

Example:

 char resp;
 Inbox *ibxConfirm new Inbox( maxx>>2, maxy>>2, POPUP, "Measurement Ended", 25);
   ibxConfirm->Paint();
   ibxConfirm->cls();
   ibxConfirm->Put( "Save data file (N) ? : ", 1);
   ibxConfirm->Scanf( "%c", &resp);
   if ( resp=='N' || resp=='n' )
      unlink(nameTdepDat);
   ibxConfirm->Remove();